import http from '../axios'
export default {
  createContest (contest) {
    return http.request({
      url: '/contest',
      method: 'post',
      headers: {
        'Content-Type': 'application/json;charset=utf-8'
      },
      data: contest
    })
  },
  getContest (id) {
    return http.get(`/contest/${id}`)
  },
  getQuesList (id, index) {
    return http.get(`/contest/${id}/${index}`)
  },
  endContest (id, answerList) {
    return http.request({
      url: `/contest/${id}`,
      data: answerList,
      method: 'post',
      headers: {
        'Content-Type': 'application/json;charset=utf-8'
      }
    })
  },
  getCurrentContests (count) {
    return http.get('/contests', {
      count
    })
  }
}
